﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FluentValidation;
using HouseHoldBudget.Infrastructure;
using HouseHoldBudget.Models.Budgets;

namespace HouseHoldBudget.Validator.Budgets
{
    public class BudgetValidator : AbstractValidator<BudgetModel>
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="BudgetValidator" /> class.
        /// </summary>
        /// <param name="localizationService">The localization service.</param>
        public BudgetValidator(ILocalizationService localizationService)
        {
            When(day => day.IsEditMode.Equals(false), () => RuleFor(u => u.BudgetName).NotEmpty().WithMessage("Le nom du budget ne peut pas être vide!"));
        }
    }
}